package com.jf.car.service.impl;

import com.jf.car.bean.Apply;
import com.jf.car.dao.ApplyDao;
import com.jf.car.dao.impl.ApplyDaoImpl;
import com.jf.car.service.ApplyService;
import com.jf.car.util.PageInfo;
import com.jf.car.util.ResultJson;

import java.util.Collections;
import java.util.List;

public class ApplyServiceImpl implements ApplyService {
    private ApplyDao applyDao = new ApplyDaoImpl();
    @Override
    public List<Apply> getAll() {
        return applyDao.getAll();
    }

    @Override
    public ResultJson getPage(PageInfo pageInfo, Apply apply) {
        List<Apply> list = applyDao.getPage(pageInfo,apply);
        int count = applyDao.getCount(apply);
        pageInfo.setPageData(list,count);
        return ResultJson.success(pageInfo);
    }

    @Override
    public ResultJson update(Apply apply) {
        return ResultJson.success(applyDao.updateSelect(apply));
    }

    @Override
    public ResultJson info(int id) {
        return ResultJson.success(applyDao.getById(id));
    }
}
